home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / TrafficEscape.dxr / 00004_Auto Movement code.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  3.2 KB  |  96 lines

  1. property spriteNum
  2. global gGameBoard, gX, gY, gCar, gCarMove, gLeft, gTop, gMoves, gLevel, gKounta, gFixxxer, gColumn, gRow
  3.  
  4. on mouseUp
  5.   if gFixxxer = 1 then
  6.     if gCarMove = 0 then
  7.       gKounta = 0
  8.       if sprite(spriteNum).rotation = 0 then
  9.         if (mouseH() > sprite(spriteNum).left) and (mouseH() < sprite(spriteNum).locH) then
  10.           gX = gColumn
  11.           gY = gRow
  12.           if gGameBoard[gY][gX - 1] = 0 then
  13.             puppetSound(1, "Engine1")
  14.             gCar = spriteNum
  15.             gLeft = 1
  16.             gCarMove = 1
  17.             gGameBoard[gY][gX - 1] = spriteNum
  18.             if sprite(spriteNum).width <= 48 then
  19.               gGameBoard[gY][gX + 1] = 0
  20.             else
  21.               gGameBoard[gY][gX + 2] = 0
  22.             end if
  23.             gMoves = gMoves + 1
  24.             member("MovesText").text = "Moves" && string(gMoves)
  25.             member("MovesText2").text = "Moves" && string(gMoves)
  26.             gFixxxer = 0
  27.           end if
  28.         else
  29.           if (mouseH() < sprite(spriteNum).right) and (mouseH() > sprite(spriteNum).locH) then
  30.             gX = gColumn
  31.             gY = gRow
  32.             if gGameBoard[gY][gX + 1] = 0 then
  33.               puppetSound(1, "Engine1")
  34.               gCar = spriteNum
  35.               gLeft = 0
  36.               gCarMove = 1
  37.               gGameBoard[gY][gX + 1] = spriteNum
  38.               if sprite(spriteNum).width <= 48 then
  39.                 gGameBoard[gY][gX - 1] = 0
  40.               else
  41.                 gGameBoard[gY][gX - 2] = 0
  42.               end if
  43.               gMoves = gMoves + 1
  44.               member("MovesText").text = "Moves" && string(gMoves)
  45.               member("MovesText2").text = "Moves" && string(gMoves)
  46.               gFixxxer = 0
  47.             end if
  48.           end if
  49.         end if
  50.       else
  51.         if (mouseV() > sprite(spriteNum).top) and (mouseV() < sprite(spriteNum).locV) then
  52.           gX = gColumn
  53.           gY = gRow
  54.           if gGameBoard[gY - 1][gX] = 0 then
  55.             puppetSound(1, "Engine1")
  56.             gCar = spriteNum
  57.             gTop = 1
  58.             gCarMove = 1
  59.             gGameBoard[gY - 1][gX] = spriteNum
  60.             if sprite(spriteNum).width <= 48 then
  61.               gGameBoard[gY + 1][gX] = 0
  62.             else
  63.               gGameBoard[gY + 2][gX] = 0
  64.             end if
  65.             gMoves = gMoves + 1
  66.             member("MovesText").text = "Moves" && string(gMoves)
  67.             member("MovesText2").text = "Moves" && string(gMoves)
  68.             gFixxxer = 0
  69.           end if
  70.         else
  71.           if (mouseV() < sprite(spriteNum).bottom) and (mouseV() > sprite(spriteNum).locV) then
  72.             gX = gColumn
  73.             gY = gRow
  74.             if gGameBoard[gY + 1][gX] = 0 then
  75.               puppetSound(1, "Engine1")
  76.               gCar = spriteNum
  77.               gTop = 0
  78.               gCarMove = 1
  79.               gGameBoard[gY + 1][gX] = spriteNum
  80.               if sprite(spriteNum).width <= 48 then
  81.                 gGameBoard[gY - 1][gX] = 0
  82.               else
  83.                 gGameBoard[gY - 2][gX] = 0
  84.               end if
  85.               gMoves = gMoves + 1
  86.               member("MovesText").text = "Moves" && string(gMoves)
  87.               member("MovesText2").text = "Moves" && string(gMoves)
  88.               gFixxxer = 0
  89.             end if
  90.           end if
  91.         end if
  92.       end if
  93.     end if
  94.   end if
  95. end
  96.